package interviewpreparationkit.array

import org.junit.jupiter.api.Test
import java.util.*
import kotlin.test.assertEquals

class HourglassSumTests {
    @Test
    fun hourglassSumTest() {

        val scan = Scanner(HourglassSumTests::class.java.getResourceAsStream("/hourglassSum.txt"))

        val arr = Array(6) { Array(6) { 0 } }

        while (scan.hasNextLine()) {
            for (i in 0 until 6) {
                arr[i] = scan.nextLine().split(" ").filter { it.isNotBlank() }.map { it.trim().toInt() }.toTypedArray()
            }

            val result = hourglassSum(arr)
            println(result)

            assertEquals(scan.nextLine().trim().toInt(), result)

        }
    }
}